/**
 * author      : dormi330
 * date        : 2018/6/24
 * project     : mybatis
 * description : 新建订单时，提交的信息
 */

package com.deep.trade.order;

import com.deep.trade.BaseDto;

import java.util.ArrayList;
import java.util.List;

public class InDtoCreateOrder extends BaseDto {

    private String tenantCode;                      // 租户code
    private String memberId;                        // 会员id 购买者
    private String addressId;                       // 会员收货地址id
    private String remark;

    private List<InDtoOrderItem> orderItemList;     // 所购sku列表

    public InDtoCreateOrder() {
    }

    public InDtoCreateOrder(String tenantCode, String memberId, String addressId, String remark) {
        this.tenantCode = tenantCode;
        this.memberId = memberId;
        this.addressId = addressId;
        this.remark = remark;
        this.orderItemList = new ArrayList<InDtoOrderItem>();
    }

    public static class InDtoOrderItem {
        private String skuId;
        private int quantity;

        public InDtoOrderItem() {
        }

        public InDtoOrderItem(String skuId, int quantity) {
            this.skuId = skuId;
            this.quantity = quantity;
        }

        public String getSkuId() {
            return skuId;
        }

        public int getQuantity() {
            return quantity;
        }

        public void setSkuId(String skuId) {
            this.skuId = skuId;
        }

        public void setQuantity(int quantity) {
            this.quantity = quantity;
        }

    }


    public void addSkuAndQty(String skuId, int qty) {
        orderItemList.add(new InDtoOrderItem(skuId, qty));
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getTenantCode() {
        return tenantCode;
    }

    public String getMemberId() {
        return memberId;
    }

    public String getAddressId() {
        return addressId;
    }

    public List<InDtoOrderItem> getOrderItemList() {
        return orderItemList;
    }

    public void setOrderItemList(List<InDtoOrderItem> orderItemList) {
        this.orderItemList = orderItemList;
    }

    public void setTenantCode(String tenantCode) {
        this.tenantCode = tenantCode;
    }

    public void setMemberId(String memberId) {
        this.memberId = memberId;
    }

    public void setAddressId(String addressId) {
        this.addressId = addressId;
    }
}